#include "stringlist.h"
#include <iostream>
namespace string_list
{
    using std::cout;
    using std::endl;
    
    struct node
    {
        string str;
        node* left;
        node* right;
    }_head,_tail;
    node* _ptail = &_tail;
    void init()
    {
        _head.str = "This is the head guard";
        _head.left = 0;
        _head.right = &_tail;
        _tail.str = "This is the tail gurad";
        _tail.right = 0;
        _tail.left = &_head;
    }
    void append(const string& str)
    {
        node* pnode = new node();
        _ptail->str = str;
        _ptail->right = pnode;
        pnode->left = _ptail;
        pnode->right = 0;
        _ptail = pnode;
        _ptail->str = "This is the tail guard";
        
    }
    void reverse()
    {
    }
    void sort()
    {
    }
    void print()
    {
        node* p = &_head;
        while( p){
            cout << p->str << " -> " << endl;
            p = p->right;
        }
    }
}

